package com.iflytek.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iflytek.bean.Admin;
import com.iflytek.bean.StockOutOrder;
import com.iflytek.bean.StockOutOrder;
import com.iflytek.service.AdminService;
import com.iflytek.service.StockOutOrderService;
import com.iflytek.vo.StockOutOrderVO;
import com.iflytek.vo.layuiPage;

@RestController
@RequestMapping("/StockOutOrder")
public class stockOutOrderController {
	@Autowired
	private StockOutOrderService stockOutOrderService;
	
	//展示
	@RequiresPermissions("StockOutOrder:show")
	@GetMapping("/show")
	public Object goodsShow() {

		List<StockOutOrderVO> Page = stockOutOrderService.selectByExample();
		
		layuiPage result = new layuiPage();
		result.setCode(0);
		result.setMsg("");
		result.setData(Page);
		return result;
	}
	
	//新增

	@PostMapping("/add")
	public Object goodsAdd(StockOutOrder stockOutOrder) {
		stockOutOrderService.insertSelective(stockOutOrder);
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		page.setData(stockOutOrder);
		return page;
		
	}
	
	//删除

	@GetMapping("/del")
	public Object goodsDelete(Integer orderId) {
		stockOutOrderService.deleteByPrimaryKey(orderId);
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		return page;
	}
	
	
	//更新

	@PostMapping("/edit")
	public Object goodsEdit(StockOutOrder stockOutOrder) {
		stockOutOrderService.updateByPrimaryKeySelective(stockOutOrder);
		
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		page.setData(stockOutOrder);
		return page;
	}
	
	
	
	
	
}
